import Vue from 'vue'

Vue.directive('loadmore', {
  bind(el, binding) {
    // 获取element-ui定义好的scroll盒子
    const selectOptionDom = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
    // const selectItemDom = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap .el-select-dropdown__item')[0];
    // console.log(selectItemDom)
    selectOptionDom.addEventListener('scroll', function () {
      const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
      if (condition) {
        binding.value()
      }
    })
  }
})
